﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections;

namespace Medianamik.Core.ImportExport
{
    public abstract class NodeDataSource<TNode, TNodeInstance, TNodeProperty> 
    {
        public abstract IEnumerable<TNode> GetNodes();
        
        public abstract Record GetRecord(TNode node);
       
        public virtual NodeDataSourceData GetData()
        {
            return new NodeDataSourceData()
            {
                 Records = GetRecords(GetNodes()).ToList(),
            };
        }

        public virtual IEnumerable<Record> GetRecords(IEnumerable<TNode> nodes)
        {
            return nodes.Select(n => GetRecord(n));
        }

       
                
        
    }
}
